﻿using System;

namespace SmallBasicFun.Analytics
{
	public class GoogleEvent
	{
		public string DomainName { get; private set; }

		public string Category { get; private set; }

		public string Action { get; private set; }

		public string Label { get; private set; }

		public int? Value { get; private set; }

		public GoogleEvent(string domainName, string category, string action, string label, int? value)
		{
			DomainName = domainName;
			Category = category;
			Action = action;
			Label = label;
			Value = value;
			Validate();
		}

		public void Validate()
		{
			if (String.IsNullOrEmpty(DomainName))
			{
				throw new ArgumentException("'DomainName' is a required field", "DomainName");
			}
			if (String.IsNullOrEmpty(Category))
			{
				throw new ArgumentException("'Category' is a required field", "Category");
			}
			if (String.IsNullOrEmpty(Action))
			{
				throw new ArgumentException("'Action' is a required field", "Action");
			}
			if (String.IsNullOrEmpty(Label))
			{
				throw new ArgumentException("'Label' is a required field", "Label");
			}
		}
	}
}